package com.zz.test.feign.fallback;

import com.ruoyi.common.core.domain.R;
import com.zz.test.feign.InventoryService;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
import com.zz.dto.InventoryResponse;
import java.util.List;
import java.util.Map;

@Component
public class InventoryServiceFallbackFactory implements FallbackFactory<InventoryService> {
    @Override
    public InventoryService create(Throwable cause) {
        return new InventoryService() {
            @Override
            public R<List<InventoryResponse>> isInStock(List<Map<String,Object>> skuCode) {
                return R.fail("库存查询失败：" + cause.getMessage());
            }
        };
    }
}
